#ifndef MYTCP_H
#define MYTCP_H
#include "tcpthread.h"
#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QThread>
#include <QKeyEvent>

QT_BEGIN_NAMESPACE
namespace Ui { class mytcp; }
QT_END_NAMESPACE

class mytcp : public QWidget
{
    Q_OBJECT

public:
    mytcp(QWidget *parent = nullptr);
    ~mytcp();
    tcpthread* mythread;

signals:
    void to_deal_jpg_data_signal(QByteArray arr,int length);

private slots:

    void readdata();                //读取tcp接收的数据
    void newconnection();           //等待客户端连接
    void on_pushButton_clicked();   //设置IP 端口号的按钮
    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);
    void send_cmd(QString str);
    void on_send_clicked();

private:
    Ui::mytcp *ui;
    QTcpServer* myserve;
    QTcpSocket* mysocket;
    QThread* thread;
    int length=6800;
};
#endif // MYTCP_H
